//
//  PromptTools.m
//  bestkeep
//
//  Created by 毛韶谦 on 2016/12/19.
//  Copyright © 2016年 utouu. All rights reserved.
//

#import "PromptTools.h"

#define BUYCARGRAYCOLOR HexColor(0xf2f2f2)

@implementation PromptTools

+ (UIView *)getViewWhenDataEndLoading {
    
    UIView *recommentFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 85)];
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 5, 40, 40)];
    UILabel *promptLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 150, 20)];
    [recommentFooterView addSubview:promptLabel];
    promptLabel.text = @"Sorry，暂时没有了~";
    [promptLabel setTextAlignment:NSTextAlignmentCenter];
    promptLabel.font = [UIFont systemFontOfSize:12];
    promptLabel.backgroundColor = [UIColor clearColor];
    promptLabel.textColor = HexColor(0xb6b6b6);
    [recommentFooterView addSubview:imageView];
    
    CGPoint center = recommentFooterView.center;
    imageView.center = CGPointMake(center.x, center.y-15);
    promptLabel.center = CGPointMake(center.x, center.y+20);
    imageView.image = [UIImage imageNamed:@"BKFooterNoMore"];
    //设置左右label的渐变色
    UILabel *leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 1)];
    UILabel *rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 1)];
    leftLabel.backgroundColor = [UIColor clearColor];
    rightLabel.backgroundColor = [UIColor clearColor];
    [recommentFooterView addSubview:leftLabel];
    [recommentFooterView addSubview:rightLabel];
    leftLabel.center = CGPointMake(center.x - 80, center.y-15);
    rightLabel.center = CGPointMake(center.x + 80, center.y-15);
    CAGradientLayer *leftGradientLayer = [CAGradientLayer layer];
    leftGradientLayer.frame = leftLabel.frame;
    leftGradientLayer.type = kCAGradientLayerAxial;
    leftGradientLayer.cornerRadius = 0.5f;
    leftGradientLayer.masksToBounds = YES;
    leftGradientLayer.colors = [NSArray arrayWithObjects:(id)BUYCARGRAYCOLOR.CGColor, (id)HexColor(0xdcdcdc).CGColor, nil];
    leftGradientLayer.startPoint = CGPointMake(0, 0.5);
    leftGradientLayer.endPoint = CGPointMake(1, 0.5);
    //        leftGradientLayer.locations = [NSArray arrayWithObjects: @0.1, @0.3, nil];
    [recommentFooterView.layer insertSublayer:leftGradientLayer atIndex:0];
    CAGradientLayer *rightGradientLayer = [CAGradientLayer layer];
    rightGradientLayer.frame = rightLabel.frame;
    rightGradientLayer.colors = [NSArray arrayWithObjects:(id)HexColor(0xdcdcdc).CGColor, (id)BUYCARGRAYCOLOR.CGColor, nil];
    rightGradientLayer.startPoint = CGPointMake(0, 0.5);
    rightGradientLayer.endPoint = CGPointMake(1, 0.5);
    rightGradientLayer.type = kCAGradientLayerAxial;
    rightGradientLayer.cornerRadius = 0.5f;
    rightGradientLayer.masksToBounds = YES;
    //        rightGradientLayer.locations = [NSArray arrayWithObjects: @0.7, @1.0, nil];
    [recommentFooterView.layer insertSublayer:rightGradientLayer atIndex:0];
    return recommentFooterView;
    
}

@end
